package com.truongnha.clienttn.business.model;

import com.truongnha.clienttn.data.entity.StudentMarkEntity;
import config.Setting;
public class StudentMarkModel {
	private int markId;
	private int number;
	private String score;
	private String time;
	private String subjectName;
	private static final int MAX_COL = Setting.MAX_COL_MARK; 

	public StudentMarkModel(int markId, int number, String score, String time,
			String subjectName) {
		super();
		this.markId = markId;
		this.number = number;
		this.score = score;
		this.time = time;
		this.subjectName = subjectName;
	}

	public StudentMarkModel(int markId, int number, String score, String time) {
		super();
		this.markId = markId;
		this.number = number;
		this.score = score;
		this.time = time;
	}

	public StudentMarkModel(StudentMarkEntity studentMarkEntity) {
		this.markId = studentMarkEntity.getMark_id();
		this.number = studentMarkEntity.getNumber();
		this.score = studentMarkEntity.getScore();
		this.time = studentMarkEntity.getTime();
	}

	public StudentMarkModel(StudentMarkEntity studentMarkEntity,
			String subjectName) {
		this.markId = studentMarkEntity.getMark_id();
		this.number = studentMarkEntity.getNumber();
		this.score = studentMarkEntity.getScore();
		this.time = studentMarkEntity.getTime();
		this.subjectName = subjectName;
	}

	public int getMarkId() {
		return markId;
	}

	public void setMarkId(int markId) {
		this.markId = markId;
	}

	public int getNumber() {
		return number;
	}

	public void setNumber(int number) {
		this.number = number;
	}

	public String getScore() {
		return score;
	}

	public void setScore(String score) {
		this.score = score;
	}

	public String getTime() {
		return time;
	}

	public void setTime(String time) {
		this.time = time;
	}

	public String getSubjectName() {
		if (subjectName.equals("Giáo dục quốc phòng"))
			return "GDQP-AN";
		else if (subjectName.equals("Giáo dục công dân"))
			return "GDCD";
		else
			return subjectName;
	}

	public void setSubjectName(String subjectName) {
		this.subjectName = subjectName;
	}

	public String getType() {
		if (number <= MAX_COL )
			return "Miệng";
		else if (number <= 2 * MAX_COL )
			return "15 phút";
		else if (number <= 3 * MAX_COL )
			return "Một tiết";
		else if (number == 3 * MAX_COL + 1 )
			return "Thi";
		else if (number == 3* MAX_COL + 2)
			return "Tbhk1";
		else if (number == 3* MAX_COL + 3)
			return "Tbhk2";
		else
			return "Tbcn";					
	}

	public String getTimeOtherFormat() {
		String[] arrTime = time.split("-");
		String otherFormat = arrTime[3] + ":" + arrTime[4] + " " + arrTime[2]
				+ "/" + arrTime[1] + "/" + arrTime[0];
		return otherFormat;
	}
}